
class Animal {
    public String name;
    public int age;
    public void eat () {
        System.out.println(this.name + "正在吃饭!");
    }

    public Animal(String name,int age){
        this.name = name;
        this.age = age;
    }
}
class Dog extends Animal{
    public Dog(String name,int age){
        super(name,age);
    }
    public void bark(){
        System.out.println(this.name+"汪汪叫");
    }

}


public class Main {
    /*
   向上转型
     */
    public static void main(String[] args) {
        Animal animal = new Dog("圆圆",18);
    }
    public static void main1(String[] args) {
        Dog dog = new Dog("圆圆",2);
        dog.eat();
        dog.bark();
        System.out.println("=================");
        /*Animal animal = new Animal("fafa",18);
        animal.eat();
        animal.bark();

        */
    }
}